import io.reactivex.Observable;

public class C51 {
    public static void main(String[] args) {
        /* Remember that Maybe and Single types do not have an onNext() event 
         * but rather an onSuccess() operator to pass a single emission.
         */
        Observable.just(5, 3, 7, 10, 2, 14)
                  .reduce((total, next) -> total + next)
                  .doOnSuccess(i -> System.out.println("Emitting: " + i))
                  .subscribe(i -> System.out.println("Received: " + i));
    }
}
//EOP
